﻿@{
    ViewBag.Title = "Stock List";
    ViewBag.Header = "Stock";
    ViewBag.Caption = "Listing";
    ViewBag.AddNewUrl = Url.Action("Maintenance", "Stock");
    ViewBag.XlsUrl = Url.Action("Export", "Stock", new { type = "Excel" });
    ViewBag.PdfUrl = Url.Action("Export", "Stock", new { type = "Pdf" });
    ViewBag.PrintUrl = Url.Action("Print", "Stock");
}
<div id="listing_Stock">
    <div class="box">
        <div class="box-body table-responsive">
            <table id="dt_Grid" class="table table-bordered table-striped">
                <thead>                    
                    <tr>
                        <th>Stockhouse</th>
                        <th>Product</th>
                        <th>IMEI# 1</th>
                        <th>IMEI# 2</th>
                        <th>Serial#</th>
                        <th>Status</th>
                        <th>&nbsp;</th>
                    </tr>                       
                </thead>
                <tbody id="dt_Rows">

                </tbody>
            </table>
        </div>
    </div>
</div>

<script id="dataTable_Grid" type="text/x-jquery-tmpl">
        <tr>
            <td>${Stockhouse}</td>
            <td>${Brand} (${ProductType}) - ${Model}</td>
            <td>${IMEI1}</td>
            <td>${IMEI2}</td>
            <td>${SerialNo}</td>
            <td>${Status}</td>
            <td><a href='@Url.Action("Delete")?Id=${Id}'>Delete</a></td>
        </tr>
    </script>

    <script type="text/javascript">
        $(document).ready(function () {
            $.getJSON('@Url.Action("GetStocks", "Stock")', function (result) {
                $.tmpl($('#dataTable_Grid'), result).appendTo('#dt_Rows');
                $('#dt_Grid').dataTable({
                    "bPaginate": true,
                    "bLengthChange": true,
                    "bFilter": true,
                    "bSort": true,
                    "bInfo": true,
                    "bAutoWidth": false
                });
            });
        });
    </script>


